﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using CarolLib;
using CarolLib.Control;
using StockMonitor.Configuration;
using StockMonitor.Helper;

namespace StockMonitor.UserControls
{
    [ModuleContract("851CC145-12CA-4A6F-B041-9985D718D70F", "查询(&Q)", "日志查询")]
    public partial class UCLogQuery : MdiUserControl
    {
        #region Ctor.

        public UCLogQuery()
            : base()
        {
            InitializeComponent();

            this.dgvEntrustHistory.AutoGenerateColumns = false;
        }

        public UCLogQuery(XmlNode node)
            : this()
        {
            InitializeComponent();
        }

        #endregion

        private void btnLogQ_Click(object sender, EventArgs e)
        {
            if (this.dtpBeginDate.Value.Date > this.dtpEndDate.Value.Date)
            {
                MessageBox.Show("起始日期不能大于结束日期", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            dgvEntrustHistory.DataSource = SystemLog.Query(this.dtpBeginDate.Value.Date, this.dtpEndDate.Value.Date);
            dgvEntrustHistory.Update();
            dgvEntrustHistory.Refresh();
        }
    }
}
